<?php
	namespace Api\Controller;
	use Think\Controller;
	header("Content-Type:text/html;charset=utf-8");
	class GetdealController extends Controller
	{
		/*
		 * 用户协议管理 
		 *   
		 */
		public function userAgreement()
		{
			$where['id'] = 1;
			$userAgreement = M("Agreement") -> field("aname,savepath") -> where($where) -> find();
			
			$data = array(
					"aname"=>$userAgreement["aname"],
					"savepath"=>"http://127.0.0.1/loveshow/Public/Uploads/agreement/".$userAgreement["savepath"]
			);
			
			//var_dump($data);
			if ($userAgreement != null)
			{
				$array['result'] = 0;
				$array['message'] = "请求数据成功！";
				$array['agreementinfo'] = $data;
				echo json_encode($array, JSON_UNESCAPED_SLASHES);
				exit;
			}
			else
			{
				$array['result'] = 10201;
				$array['message'] = "请求数据失败！";
				echo json_encode($array, JSON_UNESCAPED_SLASHES);
				exit;
			}
		}
		
		/*
		 * 用户积分规则
		 *
		 */
		public function userIntergral()
		{
			$where["id"] = 2;
			$userIntergral = M("Agreement") -> field("aname,savepath") -> where($where) -> find();
			
			$data = array(
					"aname"=>$userIntergral['aname'],
					"savepath"=>"http://127.0.0.1/loveshow/Public/Uploads/agreement/".$userIntergral["savepath"]
			);
			
			//var_dump($data);
			
			if ($userIntergral != null)
			{
				$array['result'] = 0;
				$array['message'] = "请求数据成功！";
				$array['intergralinfo'] = $data;
				echo json_encode($array, JSON_UNESCAPED_SLASHES);
				exit;
			}
			else
			{
				$array['result'] = 10201;
				$array['message'] = "请求数据失败！";
				echo json_encode($array, JSON_UNESCAPED_SLASHES);
				exit;
			}
		}
	}